package com.zoanun.tools.example.form;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class FromController {

	private static Logger logger = LoggerFactory.getLogger(FromController.class);

	
	@RequestMapping(value= "example/form", method = RequestMethod.POST)
	public ModelAndView beanPost(@ModelAttribute("loginForm") LoginForm form){
		logger.info("login id:" + form.getEmpNo());
		logger.info("password:" + form.getPassword());
		ModelAndView map = new ModelAndView();
		map.setViewName("example/form/formbean");
		map.addObject("user", form);
		return map;
	}
	
	@RequestMapping(value= "example/form", method = RequestMethod.GET)
	public String beanGet(@ModelAttribute("loginForm") LoginForm form){
		String s = "example/form/formbean";
		return s;
	}
}
